package com.itmake.webflux.swagger.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * swagger 配置
 *
 * @author Amjacks
 * @since 2023/08/10
 */
@AutoConfiguration
public class SwaggerConfig {

    @Bean
    @ConfigurationProperties(prefix = "springdoc.info")
    public Info springDocInfo() {
        return new Info();
    }

    /**
     * 创建 API
     */
    @Bean
    public OpenAPI openAPI(Info info) {
        // 构建 openapi
        return new OpenAPI().info(info);
    }
}